package homework.Test8;
/*
定义方法格式化输出字符串,例如:[88, 39, 77, 56, 89, 99, 59, 97]

int [] arr = {88,39,77,56,89,99,59,97};

 */
public class Test {
    public static void main(String[] args) {
        int [] arr = {88,39,77,56,89,99,59,97};
        String [] str = new String[arr.length];

        for (int i = 0; i < arr.length; i++) {
            str[i] = String.valueOf(arr[i]);
        }

        StringBuilder sb = new StringBuilder("[");
        for (int i = 0; i < str.length; i++) {
            if (i != str.length-1) {
                sb.append(str[i]+", ");
            }else {
                sb.append(str[i]+"]");
            }
        }

        System.out.println(sb.toString());
    }
}
